package com.zhang.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.converters.localdatetime.LocalDateTimeStringConverter;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

import com.zhang.config.LocalDateConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author Zhang
 * @since 2022-03-02
 */
@Getter
@Setter
@TableName("tb_user")
@ApiModel(value = "User对象", description = "用户表")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ExcelProperty(value = "用户ID")
    @ApiModelProperty("用户ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ExcelProperty(value = "用户名")
    @ApiModelProperty("用户名")
    private String username;

    @ExcelProperty(value = "昵称")
    @ApiModelProperty("昵称")
    private String nickname;

    @ExcelProperty(value = "邮箱")
    @ApiModelProperty("邮箱")
    private String email;

    @ExcelProperty(value = "头像")
    @ApiModelProperty("头像")
    private String avatar;

    @ExcelProperty(value = "联系电话")
    @ApiModelProperty("联系电话")
    private String phoneNumber;

    @ExcelProperty(value = "状态 0锁定 1有效")
    @ApiModelProperty("状态 0锁定 1有效")
    private Integer status;

    @ExcelProperty(value = "创建时间",converter = LocalDateTimeStringConverter.class)
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ExcelProperty(value = "修改时间",converter = LocalDateTimeStringConverter.class)
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime modifiedTime;

    @ExcelProperty(value = "性别 0男 1女 2保密")
    @ApiModelProperty("性别 0男 1女 2保密")
    private Integer sex;

    @ExcelProperty(value = "盐")
    @ApiModelProperty("盐")
    private String salt;

    @ExcelProperty(value = "0:超级管理员，1：系统用户")
    @ApiModelProperty("0:超级管理员，1：系统用户")
    private Integer type;

    @ExcelProperty(value = "密码")
    @ApiModelProperty("密码")
    private String password;

    @ExcelProperty(value = "生日",converter = LocalDateConverter.class)
    @ApiModelProperty("生日")
    private LocalDate birth;

    @ExcelProperty(value = "部门id")
    @ApiModelProperty("部门id")
    private Long departmentId;

    @ExcelIgnore
    @ApiModelProperty("逻辑删除")
    @TableLogic
    private Boolean deleted;

//    @ApiModelProperty("部门名称")
//    @TableField(exist = false)
//    private String departmentName;

}
